package com.shopping.cart.domain

import grails.test.GrailsUnitTestCase
import com.shopping.cart.Image


class ImageTests extends GrailsUnitTestCase{

    void testConstraints() {
        mockDomain Image

        Image image = new Image()

        assertFalse image.validate()
        assertEquals 2, image.errors.errorCount
        assertEquals 'nullable', image.errors.name
        assertEquals 'nullable', image.errors.location
    }

    void testDomainObjectSaves() {
        mockDomain Image
        Image image = new Image(name:'image', location: '/donkey.jpg')
        assertTrue image.validate()
    }
}